package br.ufpe.cin.msc.jrsj2.recommender.message;

public final class Message {

	public enum MessageType {
		CHANNEL, CLIENT, PROGRAM, PROFILE, CLIENT_PROFILE, PREFERRED_TIME, UNDEFINED;
	}

	public static MessageType getMessageType(String message) {
		StringBuffer msgBuffer = new StringBuffer(message);
		String mainElement = msgBuffer.substring(1, msgBuffer.indexOf(">"));
		String strMsgType = mainElement.split(" ")[0];

		if (strMsgType.equals("channel"))
			return MessageType.CHANNEL;
		else if (strMsgType.equals("client"))
			return MessageType.CLIENT;
		else if (strMsgType.equals("program"))
			return MessageType.PROGRAM;
		else if (strMsgType.equals("profile"))
			return MessageType.PROFILE;
		else if (strMsgType.equals("client-profile"))
			return MessageType.CLIENT_PROFILE;

		return MessageType.UNDEFINED;
	}

}
